<?php
class AhlifilmModel extends CI_Model {
    function _construct() {
        parent ::_construct();
        $this->load->library('session');
        $this->load->library('security');
        $this->load->library('tank_auth');
        $this->load->model('movies/ahlifilmModel');
//        $this->load->database('personafilm');

    }

//    var $table ="movies";

    function get_genre($movieId)
    {
        $data = $this->db->query("select * from genres, movies where movies.movieid = '".$movieId."' and movies.movieid = genres.movieid");
       // foreach($data->result() as $row)
       // {
            return $data;
       // }

    }

    function _destruct() {
    }

    function login($akunahlifilm, $pswd) {
        $this -> db -> select('akunahlifilm, pswd');
        $this -> db -> from('ahlifilm');
        $this -> db -> where('akunahlifilm',$akunahlifilm);
        $this -> db -> where('pswd',$pswd);
        $this -> db -> limit(1);

        $query = $this -> db -> get('');

        if($query -> num_rows() == 1) {
            return $query->result();
        }
        else {
            return false;
        }
    }

    function add_ahlifilm() {
        $AKUNAHLIFILM = $this->input->post('AKUNAHLIFILM');
        $PSWD = $this->input->post('PSWD');
        $NAMAAHLIFILM = $this->input->post('NAMAAHLIFILM');
        $data = array(
                'AKUNAHLIFILM' => $AKUNAHLIFILM,
                'PSWD' => $PSWD,
                'NAMAAHLIFILM' => $NAMAAHLIFILM,
        );
        $this->db->insert('ahlifilm', $data);
    }
}